﻿// Decompiled with JetBrains decompiler
// Type: TaleWorlds.MountAndBlade.CustomGameBannedPlayerManager
// Assembly: TaleWorlds.MountAndBlade, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: D5209D1B-76B5-47CA-B957-255CD4B2CE6B
// Assembly location: D:\steam\steamapps\common\Mount & Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.MountAndBlade.dll

using System;
using System.Collections.Generic;
using TaleWorlds.PlayerServices;

#nullable disable
namespace TaleWorlds.MountAndBlade
{
  public static class CustomGameBannedPlayerManager
  {
    private static Dictionary<PlayerId, CustomGameBannedPlayerManager.BannedPlayer> _bannedPlayers = new Dictionary<PlayerId, CustomGameBannedPlayerManager.BannedPlayer>();

    public static void AddBannedPlayer(PlayerId playerId, int banDueTime)
    {
      CustomGameBannedPlayerManager._bannedPlayers[playerId] = new CustomGameBannedPlayerManager.BannedPlayer()
      {
        PlayerId = playerId,
        BanDueTime = banDueTime
      };
    }

    public static bool IsUserBanned(PlayerId playerId)
    {
      return CustomGameBannedPlayerManager._bannedPlayers.ContainsKey(playerId) && CustomGameBannedPlayerManager._bannedPlayers[playerId].BanDueTime > Environment.TickCount;
    }

    private struct BannedPlayer
    {
      public PlayerId PlayerId { get; set; }

      public int BanDueTime { get; set; }
    }
  }
}
